const webpackMerge = require("webpack-merge")
const common = require("./webpack.common")
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin')
const TerserPlugin = require("terser-webpack-plugin")

module.exports = webpackMerge.merge(common, {
  mode: "production",
  output: {
    publicPath: "./",
  },
  plugins: [],
  optimization: {
    splitChunks: {
      chunks: 'all' //提取公共js、css到一个单独的bundle
    },
    concatenateModules: true,
    usedExports: true,
    minimize: true,
    minimizer: [
      new TerserPlugin(),
      new OptimizeCssAssetsPlugin()
    ]
  }
});
